import request from '@/utils/request'

// 查询审批列表：待审批、已通过、已驳回
export function getApprovalListByStatus(data) {
  return request({
    url: '/approval/listMyApprovals',
    method: 'post',
    data
  })
}


// 查询审批详情
export function getApprovalDetail(requestId) {
  return request({
    url: `/approval/getMyApprovalDetail?requestId=${requestId}`,
    method: 'get',
  })
}
// 审批通过
export function approveApproval(data) {
  return request({
    url: '/approval/approve',
    method: 'post',
    data
  })
}

// 审批拒绝
export function rejectApproval(data) {
  return request({
    url: '/approval/reject',
    method: 'post',
    data
  })
}

// 发送消息
export function sendMessage(data) {
  return request({
    url: '/mfMessage/send',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: data
  })
}
// 获取消息/我收到的消息
export function reciveMessageList(data) {
  return request({
    url: '/mfMessage/list',
    method: 'post',
    data
  })
}
// 获取消息/我收到的消息详情
export function reciveMessageDetail(messageId) {
  return request({
    url: `/mfMessage/detail/${messageId}`,
    method: 'get'
  })
}
// 获取消息/我发送的消息
export function sendMessageList(data) {
  return request({
    url: '/mfMessage/sent/list',
    method: 'post',
    data
  })
}
// 发送消息详情（已发送）
export function sendMessageDetail(id) {
  return request({
    url: `/mfMessage/sentMessageDetail/${id}`,
    method: 'get'
  })
}
// 已发送的消息详情中下发对象列表
export function getSentMessageReceiverList(data) {
  return request({
    url: `/mfMessage/receiver/list`,
    method: 'post',
    data
  })
}



// 下载附件
export function downloadAttachment(attachmentId) {
  return request({
    url: `/mfMessage/download/${attachmentId}`,
    method: 'get',
    responseType: 'blob'
  })
}

// 通用上传接口
export function commonUploadFile(data) {
  return request({
    url: '/common/uploadMinio',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: data
  })
}